<?php
	session_start();
	function mysqlConnect_PHP(){
		include('../config/config.inc.php');	
		$db = mysql_connect($mysql_host, $mysql_user, $mysql_pass);
		$db_select = mysql_select_db($mysql_dbname, $db);	
	}
	if((isset($_POST['bg'])) && ($_POST['bg'] != $_SESSION['background']))
	{
		mysqlConnect_PHP();
		$mysql_query = 'REPLACE INTO background(`userid`, `background`)VALUES("'.$_SESSION['userid'].'", "'.$_POST['bg'].'");'; 
		mysql_query($mysql_query);
		$_SESSION['background'] = $_POST['bg'];
	}
?>